﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YasharEl.Infrastructure.EntityModel;
using System.Runtime.Serialization;
using YasharEl.Infrastructure.ResourcesManagement;
using System.Globalization;

namespace YasharEl.Infrastructure.OrgUnit
{
    [Serializable]
    public class ManagerNotFoundException : TranslatedDomainModelException
    {
        private const string ManagerNotFound = "ManagerNotFound";

        private readonly long _managerIdentityNumber;

        public long ManagerIdentityNumber
        {
            get { return _managerIdentityNumber; }
        }

        public ManagerNotFoundException(IResourceManager resourceManager, long managerIdentityNumber)
            : base
             (
                resourceManager,
                string.Format(
                    resourceManager.GetString(ManagerNotFound, CultureInfo.GetCultureInfo("en")),
                    managerIdentityNumber
                )
             )
        {
            _managerIdentityNumber = managerIdentityNumber;
        }

        protected ManagerNotFoundException(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
        }

        protected override string ExceptionMessageResourceKey
        {
            get { return ManagerNotFound; }
        }

        public override string TranslatedMessage
        {
            get
            {
                return string.Format(resourceManager.GetString(ExceptionMessageResourceKey), ManagerIdentityNumber);
            }
        }
    }
}
